package week04.file;

/**
 * Created by zhangxiaokun on 2018/2/28.
 */
public abstract class File {
    private Integer size;
    private String path;
    private String fileName;

    public File(String path, String fileName) {
        this.path = path;
        this.fileName = fileName;
//        size = (int)Math.random()*1000;     //简化，给定随机占空间大小
        size = 0;
    }

    public abstract void open();
    public abstract void add(File file);
    public abstract void addFiles(File...fileList);
    public abstract boolean remove(File file);
    public abstract File getChild(int index);

    //判断是否为目录
    public boolean isDir() {
        if (this instanceof FileDir) {
            return true;
        } else {
            return false;
        }
    }

    public Integer getSize() {
        return size;
    }
    public void setSize(Integer size) {
        this.size = size;
    }
    public String getPath() {
        return path;
    }
    public void setPath(String path) {
        this.path = path;
    }
    public String getFileName() {
        return fileName;
    }
    public void setFileName(String fileName) {
        this.fileName = fileName;
    }
}
